<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class WaterShop extends Model
{
   use \App\Models\Traits\ScopeCompanySite;
   use \App\Models\Traits\Site;
   
   protected $fillable = [ 'name', 'num', 'unit', 'water_category_id', 'company_id', 'site_id', 'creater_uid', 'creater_name' ];
   
    public function getCompanyField() {
        return 'company_id';
    }
    
    public function getSiteField() {
        return 'site_id';
    }
    
    //项目信息
    public function companies() {
        return $this->hasOne('App\Models\Company', "Co_ID", "company_id");
    }
    //站点
    public function sites() {
        return $this->hasOne('App\Models\Site', "id", "site_id");
    }
    //分类
    public function category() {
        return $this->hasOne('App\Models\WaterCategory', "id", "water_category_id");
    }
}
